<div id="paymentInvoiceBalanceList">
  
</div>
<?php echo form_tag_for($paymentInvoiceForm,'payment/insertInvoice',array('id'=>'formPaymentInvoice',))?>
  <?php include_partiaL('payment_invoice_form',array('paymentInvoiceForm'=>$paymentInvoiceForm,))?>
  <center>
    <input type="submit" value="Add"/> | 
    <input type="button" value="Cancel" id="paymentCancellAddInvoice"/>
  </center>
</form>
<script language="javascript">
  $(document).ready(
    function(){
    
      $.get(
        'invoice/listBalance',
        <?php echo json_encode(array('customer_iden'=>$customer_iden,'click_callback'=>'paymentAddSelectInvoice','owner_iden'=>$owner_iden,))?>,
        function(content){
          $('#paymentInvoiceBalanceList').html(content);
        }
      );
      
      $('#paymentCancellAddInvoice').click(
        function(e){
          $.get(
            'payment/showInvoices',
            <?php echo json_encode(array('payment_iden'=>$payment_iden,))?>,
            function(content){
              $('#ajPaymentInvoicePanel').html(content);
            }
          );
        }
      );
      
      $('#formPaymentInvoice').submit(
        function(){
          showStatusWindow();
          $(this).ajaxSubmit({
              type: 'post',
              dataType: 'html',
              success: 
                function(data,statusText){
                  $('#ajPaymentInvoicePanel').html(data);
                  hideStatusWindow();
                },
            }
          );
          return false;
        }
      );
      
    }
  );
</script>

